package com.quick.develop.business.vo;

import com.quick.develop.flowable.domain.vo.process.BpmProcessReqVO;
import com.quick.develop.flowable.domain.vo.task.BpmTaskReqVO;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

@Data
public class BusinessProcessVO implements Serializable {

    private String businessKey;
    private String businessType;
    private Map<String, Object> data;
    private Map<String, Object> vars;
    private BpmProcessReqVO process;
    private BpmTaskReqVO task;

    public Object getDataValue(String key) {
        if (Objects.isNull(data)) {
            return null;
        }
        return data.get(key);
    }

    public Object getVarsValue(String key) {
        if (Objects.isNull(vars)) {
            return null;
        }
        return vars.get(key);
    }

    public void setDataValue(String key, Object value) {
        if (Objects.isNull(data)) {
            data = new HashMap<>();
        }
        data.put(key, value);
    }

    public void setVarsValue(String key, Object value) {
        if (Objects.isNull(vars)) {
            vars = new HashMap<>();
        }
        vars.put(key, value);
    }
}
